package com.wali.modules.bil.bo;

import com.wali.modules.bil.vo.BilGoodsVO;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author walixu
 * @ClassName com.wali.modules.common.vo
 * @Description 物品信息BO类
 * @email wali.xu@kpmg.com
 * @date 20/01/2019 2:14 下午
 */
public class BilGoodsBO implements Serializable {

    /**
     * 主键
     */
    private int id;

    /**
     * 所属运单
     */
    private String waybillNo;

    /**
     * 商品条形码
     */
    private String barcode;

    /**
     * 品牌
     */
    private String brand;

    /**
     * 名称
     */
    private String name;

    /**
     * 规格
     */
    private String specs;

    /**
     * 数量
     */
    private int count;

    /**
     * 单价
     */
    private double price;

    /**
     * 创建时间
     */
    private String createTime;

    /**
     * 更新时间
     */
    private String updateTime;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getWaybillNo() {
        return waybillNo;
    }

    public void setWaybillNo(String waybillNo) {
        this.waybillNo = waybillNo;
    }

    public String getBarcode() {
        return barcode;
    }

    public void setBarcode(String barcode) {
        this.barcode = barcode;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSpecs() {
        return specs;
    }

    public void setSpecs(String specs) {
        this.specs = specs;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(String updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BilGoodsBO that = (BilGoodsBO) o;
        return id == that.id &&
                count == that.count &&
                Double.compare(that.price, price) == 0 &&
                Objects.equals(waybillNo, that.waybillNo) &&
                Objects.equals(barcode, that.barcode) &&
                Objects.equals(brand, that.brand) &&
                Objects.equals(name, that.name) &&
                Objects.equals(specs, that.specs) &&
                Objects.equals(createTime, that.createTime) &&
                Objects.equals(updateTime, that.updateTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, waybillNo, barcode, brand, name, specs, count, price, createTime, updateTime);
    }

    @Override
    public String toString() {
        return "BilGoodsVO{" +
                "id=" + id +
                ", waybillNo='" + waybillNo + '\'' +
                ", barcode='" + barcode + '\'' +
                ", brand='" + brand + '\'' +
                ", name='" + name + '\'' +
                ", specs='" + specs + '\'' +
                ", count=" + count +
                ", price=" + price +
                ", createTime='" + createTime + '\'' +
                ", updateTime='" + updateTime + '\'' +
                '}';
    }

    /**
     * @param
     * @return
     * @throws
     * @Title convert
     * @Description 将BilGoodsBO转化为BilGoodsVO
     */
    public static BilGoodsVO convert(BilGoodsBO bilGoodsBO) {
        BilGoodsVO temp = new BilGoodsVO();
        temp.setBarcode(bilGoodsBO.getBarcode());
        temp.setBrand(bilGoodsBO.getBrand());
        temp.setCount(bilGoodsBO.getCount());
        temp.setCreateTime(bilGoodsBO.getCreateTime());
        temp.setId(bilGoodsBO.getId());
        temp.setName(bilGoodsBO.getName());
        temp.setPrice(bilGoodsBO.getPrice());
        temp.setSpecs(bilGoodsBO.getSpecs());
        temp.setUpdateTime(bilGoodsBO.getUpdateTime());
        temp.setWaybillNo(bilGoodsBO.getWaybillNo());
        return temp;
    }
}
